<template>
  <view>
    <view class="home_tap">
      <view class="home_tap_title">
        <view class="title_inner">
          <uni-segmented-control
            :current="current"
            :values="items.map(v=>v.title)"
            @clickItem="onClickItem"
            style-type="text"
            active-color="#4cd964"
          ></uni-segmented-control>
        </view>
        <view class="iconfont icon-soushuo"></view>
      </view>
      <view class="home_tap_content content">
      <view v-if="current<4">
          <video-for :urlObj="{url:items[current].url,params:items[current].params}">12321</video-for>
      </view>
       <view v-if="current===4">
          <video-last :urlObj="{url:items[current].url,params:items[current].params}">132312</video-last>
      </view>
      </view>
    </view>
  </view>
</template>

<script>

import { uniSegmentedControl } from "@dcloudio/uni-ui";
import videoFor from "./video-for"
import videoLast from "./video-last"
export default {
  components: {
    uniSegmentedControl,
    videoFor,
    videoLast
  },
  data() {
    return {
      items: [
        { title: "推荐",url:"http://157.122.54.189:9088/videoimg/v1/videowp/featured",params:{limit:30,skip:0,order:"hot"} },
        { title: "娱乐",url:"http://157.122.54.189:9088/videoimg/v1/videowp/category/59b25abbe7bce76bc834198a",params:{limit:30,skip:0,order:"new"}  },
        { title: "最新",url:"http://157.122.54.189:9088/videoimg/v1/videowp/videowp",params:{limit:30,skip:0,order:"new"}  },
        { title: "热门",url:"http://157.122.54.189:9088/videoimg/v1/videowp/videowp",params:{limit:30,skip:0,order:"hot"}  },
        { title: "分类",url:"http://157.122.54.189:9088/videoimg/v1/videowp/category",params:{}  }
      ],
      current:0
    };
  },
  methods: {
    onClickItem(e) {
      if (this.current !== e.currentIndex) {
        this.current = e.currentIndex;
      }
    }
  },
};
</script>

<style lang="scss" scoped>
.home_tap{
 
  .home_tap_title{
     position: relative;
     border-bottom:1px solid #cccccc;
    .title_inner{
      width:60%;
      margin:0 auto;
    }
    .iconfont{
    position:absolute;
    top:50%;
    transform: translateY(-50%);
    right:5%;
    }
  }
  .home_tap_content {}
}
</style>